package esiag.pds.contextManagement;


import java.io.Serializable;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;

import javax.sound.midi.MidiDevice.Info;

import javolution.util.FastList;

import esiag.pds.beans.Information;
import esiag.pds.interfaces.IgetContext;


public class Context implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private ArrayList<FastList<Serializable>> context;
	
	public Context()  {
		// TODO Auto-generated constructor stub
		context=new ArrayList<FastList<Serializable>>();
	}
	
	public void addList(FastList<Serializable>list){
		context.add(list);
	}
	
	
	public int getNbList(){
		return context.size();
	}

	public  List<Serializable> getList(int index){
		if(index<=context.size())
			return context.get(index);
		return null;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "Context : Nb list = " + context.size();
	}
	
	public ArrayList<FastList<Serializable>> getTab(){
		return context;
	}
	

	public boolean isTheSameAs(Context otherOne){
		if (getNbList()!=otherOne.getNbList())
			return false;
		for (int i = 0; i < getTab().size(); i++) {
			if (getTab().get(i).size()!=otherOne.getTab().get(i).size()) {
				System.out.println("hna l mouchkil "+i);
				return false;
			}
		}
		return true;
	}
}
